import java.util.Scanner;

public class Switchexcese4 {
    public static void main(String[] args) {

        int[] days = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};

        System.out.println("请输入年 月 日");
        Scanner scanner=new Scanner(System.in);
        int year= scanner.nextInt();
        int month= scanner.nextInt();
        int day= scanner.nextInt();
        int newday=day;
       if((year % 4 == 0 && year % 100 != 0 || year % 400 == 0)&&(month>2))
           newday=day+1;
       int p=0;
       for(int i=0;i<month-1;i++)
           p+=days[i];
       p+=newday;
        System.out.println(p);
    }
}
